package com.wcq.studentbackend.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.time.LocalDateTime;

@Data
@EqualsAndHashCode(callSuper = false)
@TableName("exams") // 假设数据库表名为 exams
public class Exam implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @TableField("exam_name")
    private String examName;

    private String subject; // 如果字段名与属性名一致，可以省略 @TableField

    @TableField("exam_time")
    private LocalDateTime examTime;

    private String location;

    private String description;

    @TableField(value = "create_time") // , fill = FieldFill.INSERT) // 如果使用MyBatis-Plus自动填充
    @DateTimeFormat(pattern = "yyyy-MM-dd'T'HH:mm")
    @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm")
    private LocalDateTime createTime;

    @TableField(value = "update_time") // , fill = FieldFill.INSERT_UPDATE) // 如果使用MyBatis-Plus自动填充
    @DateTimeFormat(pattern = "yyyy-MM-dd'T'HH:mm")
    @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm")
    private LocalDateTime updateTime;
} 